package main

import "fmt"

type Mover interface {
	Move()
}

type Locker interface {
	Lock()
	Unlock()
}

type MoveLocker interface {
	Mover
	Locker
}

type Bike struct{}

func (b Bike) Move() {
	fmt.Println("bike is moving")
}

func (b Bike) Lock() {
	fmt.Println("bike is locked")
}

func (b Bike) Unlock() {
	fmt.Println("bike is unlocked")
}

func main() {
	var m1 MoveLocker
	var m Mover

	m1 = Bike{}
	// 编译通过，因为MoveLocker中含有Mover的全部方法
	m = m1
	// 编译不通过， 因为Mover中缺失MoveLocker的部分方法
	// m1 = m

	b := m.(Bike)
	m1 = b

	m1.Move()
	m1.Lock()
	m1.Unlock()
}
